from django.shortcuts import HttpResponse
from django.http import JsonResponse
import json
from lottery.view import mysql_util
def hello(request):
    # data = {"msg":"神星"}
    # return JsonResponse(data)
    response = HttpResponse(json.dumps({"msg": "success", "key2": "value"}))
    response["Access-Control-Allow-Origin"] = "*"
    # response["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS"
    # response["Access-Control-Max-Age"] = "1000"
    # response["Access-Control-Allow-Headers"] = "*"
    return response

def add_prize(request):
    receive = request.body
    print(receive)
    print("fanrena ")
    cursor = mysql_util.getconn()
    response = HttpResponse(json.dumps({"msg": "success"}))
    response["Access-Control-Allow-Origin"] = "*"
    response["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS"
    response["Access-Control-Max-Age"] = "1000"
    response["Access-Control-Allow-Headers"] = "*"
    return response